//循环
var nameList = List("Mary", "Mike", "Jack");


println("***********第一种写法************")

//<-表示提取符
for (s <- nameList) {
  println(s)
};


println("***********第二种写法************")

//打印长度大于3的名字
//循环的时候加入判断条件
for {
  s <- nameList;
  if (s.length > 3)
}
  println(s)



println("***********第三种写法************")
for (s <- nameList if s.length > 3) println(s)


println("***********while循环************")
var i = 0
while (i < nameList.length) {
  println(nameList(i))
  i += 1
}





println("***********集合元素大写************")
//重写赋值
var newNameList = for {
  s <- nameList
  s1 = s.toUpperCase
} yield (s1)

println("***********call by value***********")
def test1(x: Int, y: Int): Int = x + x

println("***********call by name***********")
def test2(x: => Int, y: => Int): Int = x + x


test1(3+4,8);


test2(3+4,8);



println("***********复杂案例***********")

def test3(x:Int,y: =>Int):Int=1


def loop():Int=loop

println("***********2***********")
test3(1,loop)


println("***********1***********")
test3(loop,1)




















